Skip to content

fix(aggregator): produce-charge-candidates rejects unknown/duplicated arguments (#7301) - #7306

Closed
dezren39 wants to merge 1 commit into
mainfrom
creator-a/7301-produce-charge-unknown-args
Closed

dezren39 wants to merge 1 commit into
mainfrom
creator-a/7301-produce-charge-unknown-args

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Fixes #7301

produce-charge-candidates probed argv token-by-token only (argValue() via indexOf, --skip-gmail via includes), so unknown tokens were silently ignored — the unknown-token half left after #3333 hardened the values:

  • --strat 2026-09-01 (typo) → candidates written for the default current-month period, exit 0
  • --start=2026-09-01 (joined) → same wrong default period, exit 0
  • --skip-gmal (typo) → the Gmail read ran anyway, exit 0
  • duplicate --start → first silently wins, exit 0

Verified pre-fix on the laptop at main 688f44dbe0 with the real script (md5-checked) against stub Plaid/Gmail CLIs (probe ~/git/fleet/probe-charge-unknown-args); control case behaved correctly.

Change

Verification

  • Suite on the branch (laptop): 49/49 pass; the 6 new tests fail on the pre-fix script (43 pass / 6 fail with the fix stashed).
  • Post-fix probe: typo'd --strat → exit 2 producer: unknown argument "--strat" ...; control invocation → exit 0, correct period written.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Bug Fixes
    • Invalid, misspelled, joined, or duplicate command-line options now return a usage error before running data collection or changing candidate files. Recognized options remain supported, and staged mode continues to ignore --start and --end.

… arguments before any connector call or file write (#7301)
@dezren39
dezren39 requested a review from a team as a code owner November 8, 2026 05:24
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T05:25:50.582329Z a86aea9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

The charge-candidate script now rejects unknown, joined, and duplicate CLI arguments with exit code 2 before parsing values or performing connector calls or file writes. New live-mode tests check usage errors and verify that rejected arguments cause no side effects.

Changes: Charge candidate CLI validation

Layer / File(s) Summary
Validate CLI arguments before candidate generation
pm-stack/aggregator/scripts/produce-charge-candidates.ts, pm-stack/aggregator/test/produce-charge-candidates.test.ts
The script validates arguments before parsing or performing connector and file operations. It rejects unknown, joined, and duplicate arguments with exit code 2. Tests check these errors and verify that connectors are not called and candidate files are not changed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: Low · up to a86ae

Argument validation improves, but staged invocations can still hide duplicate flags and write output instead of reporting a usage error. The remaining risk is narrow and has a localized fix.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39

dezren39 commented Nov 8, 2026

Copy link
Copy Markdown
Member Author

Closing as a duplicate per the salvage protocol (lifecycle protocol §8).

This PR implemented the same fix as canonical PR #7304 (for issue #7302), which merged at 2026-11-08T05:21:42Z while this branch was in flight — the two creator lanes filed the same verified defect minutes apart (issue #7301 here, issue #7302 by lane B) and both self-solved it.

Salvage note posted on PR #7304 (comment 6717722652): the diffs were compared line by line; the merged fix is functionally identical and its tests cover every case here plus a positional-argument case — nothing unique to lift. Issue #7301 is closed as a duplicate of issue #7302; the defect is fixed on main by edbf41d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant